package localedate01;

import java.time.LocalDate;

/*
  LocalDate的计算和判断功能：
        LocalDate plusYears(long yearsToAdd)           //在原有的年份基础上，加上指定的年份
        LocalDate minusMonths(long monthsToSubtract)   //在原有的月份的基础上，减去指定的月份

        boolean isLeapYear()                           //如果当前年份是闰年，返回true，不是就返回平年
        boolean isEqual(ChronoLocalDate other)
 */
public class LocalDateDemo03 {
    public static void main(String[] args) {
        //method01();

        //method02();

        LocalDate now = LocalDate.now();
        System.out.println(now.isEqual(now));
        LocalDate now2 = LocalDate.of(2023, 11, 3);
        System.out.println(now.isEqual(now2));


    }

    private static void method02() {
        LocalDate now = LocalDate.now();
        System.out.println(now);

        System.out.println(now.isLeapYear());
        System.out.println(now.withYear(2000).isLeapYear());
    }

    private static void method01() {
        LocalDate now = LocalDate.now();
        System.out.println(now);

        LocalDate now2 = now.plusYears(3);
        System.out.println(now2);

        LocalDate now3 = now.minusMonths(4);
        System.out.println(now3);
    }
}
